<%@ page contentType="text/html;charset=UTF-8" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>微电影管理系统</title>
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <link rel="shortcut icon" href="${pageContext.request.contextPath}/resource/static/base/images/logo.png">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/resource/static/admin/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/resource/static/fonts/css/font-awesome.min.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/resource/static/ionicons/css/ionicons.min.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/resource/static/admin/dist/css/AdminLTE.min.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/resource/static/admin/dist/css/skins/_all-skins.min.css">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/resource/static/admin/plugins/datepicker/datepicker3.css">
    <style>
        *{
            font-family:"Microsoft YaHei";
        }
        .table>tbody>tr>td, .table>tbody>tr>th, .table>tfoot>tr>td, .table>tfoot>tr>th, .table>thead>tr>td, .table>thead>tr>th{
            vertical-align:middle;
            text-align:center;
        }

    </style>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">

    <%@ include file="../5-public/AdminSidebar.jsp" %>

    <div class="content-wrapper">
        <!--内容-->
        <section class="content-header">
            <h1>微电影管理系统</h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i> 管理员管理</a></li>
                <li class="active">添加管理员</li>
            </ol>
        </section>
        <section class="content" id="showcontent">
            <div class="row">
                <div class="col-md-12">
                    <div class="box box-primary">
                        <div class="box-header with-border">
                            <h3 class="box-title">添加管理员</h3>
                        </div>
                        <form id="adminadd">
                            <div class="box-body">
                                <div class="form-group">
                                    <label for="input_name">管理员名称</label>
                                    <input type="text" class="form-control" id="input_name" placeholder="请输入管理员名称！">
                                </div>
                                <div class="form-group">
                                    <label for="input_pwd">管理员密码</label>
                                    <input type="password" class="form-control" id="input_pwd" placeholder="请输入管理员密码！">
                                </div>
                                <div class="form-group">
                                    <label for="input_re_pwd">管理员重复密码</label>
                                    <input type="password" class="form-control" id="input_re_pwd"
                                           placeholder="请输入管理员重复密码！">
                                </div>
                                <div class="form-group">
                                    <label for="input_role_id">所属角色</label>
                                    <select class="form-control" id="input_role_id">
                                        <option value="0">普通管理员</option>
                                        <option value="1">超级管理员</option>
                                    </select>
                                </div>
                            </div>
                            <div class="box-footer">
                                <input type="submit" class="btn btn-primary" value="添加">
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </section>
        <!--内容-->
    </div>
    <footer class="main-footer">
        <div class="pull-right hidden-xs">
            <b>版本</b> 1.0
        </div>
        <strong>版权 &copy; 2017-2018 归<a href="">xxx</a>.</strong> 所有
    </footer>
    <div class="control-sidebar-bg"></div>
</div>
<script src="${pageContext.request.contextPath}/resource/static/admin/plugins/jQuery/jQuery-2.2.0.min.js"></script>
<script src="${pageContext.request.contextPath}/resource/static/admin/bootstrap/js/bootstrap.min.js"></script>
<script src="${pageContext.request.contextPath}/resource/static/admin/plugins/slimScroll/jquery.slimscroll.min.js"></script>
<script src="${pageContext.request.contextPath}/resource/static/admin/plugins/fastclick/fastclick.js"></script>
<script src="${pageContext.request.contextPath}/resource/static/admin/dist/js/app.min.js"></script>
<script src="${pageContext.request.contextPath}/resource/static/admin/dist/js/demo.js"></script>
<script src="//cdn.bootcss.com/holder/2.9.4/holder.min.js"></script>
<script src="${pageContext.request.contextPath}/resource/static/admin/plugins/datepicker/bootstrap-datepicker.js"></script>
<script src="${pageContext.request.contextPath}/resource/static/admin/plugins/datepicker/locales/bootstrap-datepicker.zh-CN.js" charset="UTF-8"></script>
<script>
    $(document).ready(
        function () {
            $("#adminadd").on("submit", function () {
                var name=$("#input_name").val();
                var newpawd=$("#input_pwd").val();
                var rnewpawd=$("#input_re_pwd").val();
                var statues=$("#input_role_id").val();
                var rdata={
                    "name":name,
                    "newPassword":newpawd,
                    "reNewPassword":rnewpawd,
                    "statues":statues,
                    "role":1
                }
                $.ajax({
                    url:"/person/adminadd",
                    data:rdata,
                    type:"post",
                    dataType:"json",
                    success:function (res) {
                        alert(res.msg);
                        if (res.code=="200"){
                            location.href="/person/toAdminAdd"
                        }
                    },
                    error:function (e1,e2,e3) {
                        console.log(e1);
                        console.log(e2);
                        console.log(e3);
                    }
                })
                return false;
            })
        }
    )
</script>

</body>
</html>